﻿using NUnit.Framework;

namespace MineSweeperCheater.Test
{
  [TestFixture]
  class TestAnalyzeMineFieldCell
  {
    [Test]
    public void GoodCase1()
    {

      const char inputCellContent = '*';
      const int inputRow = 1;
      const int inputCol = 1;
      var result = new int[5, 8]
                       {
                         {0, 0, 0, 0, 0, 0, 0, 0},
                         {0, 0, 0, 0, 0, 0, 0, 0},
                         {0, 0, 0, 0, 0, 0, 0, 0},
                         {0, 0, 0, 0, 0, 0, 0, 0},
                         {0, 0, 0, 0, 0, 0, 0, 0},
                       };
      Cheater.AnalyzeMineFieldCell(inputCellContent, inputRow, inputCol, ref result);

      var expected = new int[5, 8]
                       {
                         {0, 0, 0, 0, 0, 0, 0, 0},
                         {0, 1, 1, 1, 0, 0, 0, 0},
                         {0, 1, 0, 1, 0, 0, 0, 0},
                         {0, 1, 1, 1, 0, 0, 0, 0},
                         {0, 0, 0, 0, 0, 0, 0, 0},
                       };

      Assert.That(result, Is.EqualTo(expected));
    }

    [Test]
    public void GoodCase2()
    {

      const char inputCellContent = '*';
      const int inputRow = 2;
      const int inputCol = 6;
      var result = new int[5, 9]
                       {
                         {0, 0, 0, 0, 0, 0, 0, 0, 0},
                         {0, 0, 0, 0, 0, 0, 0, 0, 0},
                         {0, 0, 0, 0, 0, 0, 0, 0, 0},
                         {0, 0, 0, 0, 0, 0, 0, 0, 0},
                         {0, 0, 0, 0, 0, 0, 0, 0, 0},
                       };
      Cheater.AnalyzeMineFieldCell(inputCellContent, inputRow, inputCol, ref result);

      var expected = new int[5, 9]
                       {
                         {0, 0, 0, 0, 0, 0, 0, 0, 0},
                         {0, 0, 0, 0, 0, 0, 0, 0, 0},
                         {0, 0, 0, 0, 0, 0, 1, 1, 1},
                         {0, 0, 0, 0, 0, 0, 1, 0, 1},
                         {0, 0, 0, 0, 0, 0, 1, 1, 1},
                       };

      Assert.That(result, Is.EqualTo(expected));
    }

  }
}
